import { type SlateElement } from "@wangeditor/editor";
import { constant, AttachmentElement } from "./constant";
/**
 * 生成“附件”元素的 HTML
 * @param elem 附件元素
 * @param childrenHtml 子节点的 HTML 代码，void 元素可忽略
 * @returns “附件”元素的 HTML 字符串
 */
function attachmentToHtml(elem: SlateElement, childrenHtml: string): string {
  const { value = "" } = elem as AttachmentElement;
  const html = `<div data-w-e-type="${constant.type}" data-value='${value}' style='justify-content:center;display: flex;'><div
  style="display: inline-block;
  width: auto;
  border: 1px solid;
  box-shadow: rgb(43, 179, 241) 6px 6px 0px 0px;
  font-weight:900;
  margin:0 10px;
  padding: 8px">${value}</div></div>`;
  return html;
}
const elemToHtmlConf = {
  type: constant.type,
  elemToHtml: attachmentToHtml
};
export default elemToHtmlConf;
